package com.fmblzf.library.listview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.example.administrator.library.R;
import com.fmblzf.library.adapter.BaseSuperAdapter;
import com.fmblzf.library.adapter.ViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2015/11/10.
 */
public class TableListViewAdapter extends BaseSuperAdapter<TextObject> {

    public TableListViewAdapter(Context context, List<TextObject> list) {
        super(context, list);
    }

    @Override
    public void setmList(List<TextObject> mList) {
        super.setmList(mList);
        notifyDataSetChanged();
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        if (view == null)
            view = LayoutInflater.from(mContext).inflate(R.layout.table_row_col_list_style, null, false);
        TextView account = ViewHolder.getInstance().getView(view, R.id.tv_personal_account);
        TextView relation = ViewHolder.getInstance().getView(view, R.id.tv_personal_relation);
        TextView crowdCount = ViewHolder.getInstance().getView(view, R.id.tv_personal_crowd_count);
        TextView rate = ViewHolder.getInstance().getView(view, R.id.tv_personal_rate);

        TextObject to = mList.get(i);
        account.setText(to.getAccount());
        relation.setText(to.getRelation());
        crowdCount.setText(to.getCrowdCount());
        rate.setText(to.getRate());

        return view;
    }
}
